#include "wx/wxprec.h"
#if wxUSE_XRC && wxUSE_GRID

#include "wx/xrc/xh_grid.h"
#include "wx/grid.h"

IMPLEMENT_DYNAMIC_CLASS( wxGridXmlHandler, wxXmlResourceHandler )

wxGridXmlHandler::wxGridXmlHandler()
  : wxXmlResourceHandler() {
  AddWindowStyles();
}

wxObject *wxGridXmlHandler::DoCreateResource() {
  XRC_MAKE_INSTANCE( grid, wxGrid )
  grid->Create( m_parentAsWindow,
                GetID(),
                GetPosition(), GetSize(),
                GetStyle( wxT( "style" ) ),
                GetName() );
  SetupWindow( grid );
  return grid;
}

bool wxGridXmlHandler::CanHandle( wxXmlNode *node ) {
  return IsOfClass( node, wxT( "wxGrid" ) );
}

#endif // wxUSE_XRC && wxUSE_GRID
